home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok56.lha
/
TurboFiles_V2.0
/
SpeedCheck.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
4KB
|
191 lines
MODULE SpeedCheck;
IMPORT TF:TurboFiles,
FS:FileSystem,
TS:TimerSupport,
Timer,
Strings,
SYSTEM,
Break,
io;
CONST
Write=TRUE;
ReadOnly=FALSE;
VAR
time:Timer.TimeVal;
f:TF.File;
file:FS.File;
c:CHAR;
l:LONGINT;
i,size:LONGINT;
bufferSize:LONGINT;
readName,writeName:ARRAY 80 OF CHAR;
PROCEDURE WriteTime(text:ARRAY OF CHAR);
(* $CopyArrays- *)
BEGIN
TS.ReadClock(time);
io.WriteString(text);
io.Write(':');
l:=Strings.Length(text);
WHILE l<26 DO
io.Write(' ');
INC(l);
END;
TS.WriteTime(time);
END WriteTime;
BEGIN
io.WriteString('\nTurboFiles vs. FileSystem\n');
io.WriteString('~~~~~~~~~~~~~~~~~~~~~~~~~~\n');
io.WriteString('File for reading: ');
io.ReadString(readName);
io.WriteString('File for writing: ');
io.ReadString(writeName);
io.WriteString('BufferSize for TurboFiles: ');
IF NOT io.ReadInt(bufferSize) THEN
io.WriteString('Default = 1024\n');
bufferSize:=1024
END;
IF TF.Exists(readName,size) THEN
io.WriteString('FileSize: ');
io.WriteInt(size,8);
io.WriteLn;
ELSE
io.WriteString('File not found\n');
HALT(0);
END;
io.WriteLn;
io.WriteString('Reading single Characters using ReadChar()\n');
TS.StartClock;
IF TF.Open(f,readName,bufferSize,TF.oldFile) THEN
WHILE TF.ReadChar(f,c) DO END;
WriteTime('TurboFiles.ReadChar()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,readName,ReadOnly) THEN
WHILE FS.ReadChar(file,c) DO END;
WriteTime('FileSystem.ReadChar()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteString('Reading LONGINTs using ReadBytes()=ReadBlock()\n');
TS.StartClock;
IF TF.Open(f,readName,bufferSize,TF.oldFile) THEN
WHILE TF.ReadBytes(f,SYSTEM.ADR(l),SYSTEM.SIZE(l))>0 DO END;
WriteTime('TurboFiles.ReadBytes()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,readName,ReadOnly) THEN
WHILE FS.ReadBlock(file,SYSTEM.ADR(l),SYSTEM.SIZE(l)) DO END;
WriteTime('FileSystem.ReadBlock()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteString('Reading LONGINTs using Read()\n');
TS.StartClock;
IF TF.Open(f,readName,bufferSize,TF.oldFile) THEN
WHILE TF.Read(f,l) DO END;
WriteTime('TurboFiles.Read()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,readName,ReadOnly) THEN
WHILE FS.Read(file,l) DO END;
WriteTime('FileSystem.Read()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteString('Writing single Characters using WriteChar()\n');
TS.StartClock;
IF TF.Open(f,writeName,bufferSize,TF.newFile) THEN
i:=0;
WHILE i<size DO
IF TF.WriteChar(f,c) THEN END;
INC(i);
END;
WriteTime('TurboFiles.WriteChar()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,writeName,Write) THEN
i:=0;
WHILE i<size DO
IF FS.WriteChar(file,c) THEN END;
INC(i);
END;
WriteTime('FileSystem.WriteChar()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteString('Writing LONGINTSs using WriteBytes()=WriteBlock()\n');
TS.StartClock;
IF TF.Open(f,writeName,bufferSize,TF.newFile) THEN
i:=0;
WHILE i<size DO
IF TF.WriteBytes(f,SYSTEM.ADR(l),SYSTEM.SIZE(l)) THEN END;
INC(i,4);
END;
WriteTime('TurboFiles.WriteBytes()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,writeName,Write) THEN
i:=0;
WHILE i<size DO
IF FS.WriteBlock(file,SYSTEM.ADR(l),SYSTEM.SIZE(l)) THEN END;
INC(i,4);
END;
WriteTime('FileSystem.WriteBlock()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteString('Writing LONGINTSs using Write()\n');
TS.StartClock;
IF TF.Open(f,writeName,bufferSize,TF.newFile) THEN
i:=0;
WHILE i<size DO
IF TF.Write(f,l) THEN END;
INC(i,4);
END;
WriteTime('TurboFiles.Write()');
IF TF.Close(f) THEN END;
END;
TS.StartClock;
IF FS.Open(file,writeName,Write) THEN
i:=0;
WHILE i<size DO
IF FS.Write(file,l) THEN END;
INC(i,4);
END;
WriteTime('FileSystem.Write()');
IF FS.Close(file) THEN END;
END;
io.WriteLn;
io.WriteLn;
END SpeedCheck.